public class comprehensiveExercises {
}
abstract class Animal{
    protected int legs;

    public Animal() {
    }

    public Animal(int legs) {
        this.legs = legs;
    }

    public void walk(){
            System.out.println("该动物依靠"+legs+"条腿行走");
        }
        public abstract void   eat();
}
class Spider extends Animal{
    public Spider(int legs) {
        super(legs);
        super.legs=8;
    }

    public void eat(){
        System.out.println("蜘蛛依靠捕猎吃饭");
    }
}
interface Pet{
    public void getName(String name);

    public void setName(String name);
    public void play();
}
class Cat extends Animal implements Pet{
    String name;
    public Cat(){
        this(null);
    }

    @Override
    public void getName(String name) {
            
    }

    @Override
    public void setName(String name) {
        this.name = name;
    }

    @Override
    public void play() {
        System.out.println("小猫爱玩");
    }

    public void eat(){
        System.out.println("小猫爱吃鱼");
    }
    public Cat(String name) {
        this.name = name;
        System.out.println("所有的猫都有"+super.legs+"条腿");
    }
}
class Fish extends Animal implements Pet{
    public Fish() {
    }
    private  String name;
    @Override
    public void eat() {
        System.out.println("鱼爱吃鱼食");
    }
    @Override
    public void walk() {
        System.out.println("鱼不能走且没有腿");
    }

    public void  getName(String name) {

    }

    @Override
    public void setName(String name) {
        this.name = name;
    }

    public void play() {
        System.out.println("鱼爱玩水");
    }
}